import os
import fnmatch

def locate_walk(pattern, root=os.curdir):
    for path, dirs, files in os.walk(os.path.abspath(root)):
        for filename in fnmatch.filter(files, pattern):
            yield os.path.join(path, filename)

def select_files(root=os.curdir):
    files = os.listdir(os.path.abspath(root))
    for item in files:
       if os.path.isfile(os.path.join(root, item)):
          yield item
           
def execute(pattern, root=os.curdir):
    files = fnmatch.filter(select_files(root), pattern)
    for item in files:
        (head, tail) = item.split('.')
        yield head

import sys

if __name__ == "__main__":
   if len(sys.argv) == 2:
      for item in execute(sys.argv[1]):
          print item
   elif len(sys.argv) == 3:
      for item in execute(sys.argv[1], sys.argv[2]):
          print item

